import component from './toast.vue';
let index = 9999;
function Toast (text, duration) {
    let div = document.createElement('div'),
        el = document.createElement('div'),
        props = {
            text: text,
            zIndex: index++,
            duration: duration
        };
    document.body.appendChild(div);
    div.appendChild(el);
    let vueClass = Vue.extend(component);
    let vm = new vueClass({
        el: el,
        propsData: props
    });
    vm.$on('close', function () {
        div.remove();
        --index;
    })
}

export default Toast;